<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>layout 后台大布局 - Layui</title>
    <link rel="stylesheet" href="/static/layui/css/layui.css">
</head>

<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">

    <div class="layui-body">
        <form class="layui-form" requrl="" action="">
            <div>
                <div class="layui-form-item">
                    <label class="layui-form-label">项目所属</label>
                    <div class="layui-input-inline">
                        <#if (logMessage.belongProject)??>
                        <select name="belongProject" id="select">
                            <option value="其他" <#if logMessage.belongProject == "其他">selected</#if>>其他</option>
                            <option value="8357保密系统"<#if logMessage.belongProject == "8357保密系统">selected</#if>>8357保密系统</option>
                            <option value="网检系统" <#if logMessage.belongProject == "网检系统">selected</#if>>网检系统</option>
                            <option value="应用数学中心" <#if logMessage.belongProject == "应用数学中心">selected</#if>>应用数学中心</option>
                            <option value="306保密系统" <#if logMessage.belongProject == "306保密系统">selected</#if>>306保密系统</option>
                        </select>
                        <#else>
                        <select name="belongProject" id="select">
                            <option value="其他">其他</option>
                            <option value="8357保密系统">8357保密系统</option>
                            <option value="网检系统">网检系统</option>
                            <option value="应用数学中心">应用数学中心</option>
                            <option value="306保密系统">306保密系统</option>
                        </select>
                    </#if>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">日志标题</label>
                    <div class="layui-input-inline">
                        <input type="text" name="logTitle" class="layui-input" value="${(logMessage.logTitle)!}">

                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">填写人</label>
                    <div class="layui-input-inline">
                        <input type="text" name="" class="layui-input" value="${(loginer.name)!}" readonly="readonly">
                        <input type="hidden" name="id" value="${(loginer.id)!}">
                    </div>
                </div>
                <div class="layui-form-item layui-form-text">
                    <label class="layui-form-label">任务描述</label>
                    <div class="layui-input-inline">
                        <textarea name="logDescription" placeholder="任务描述" class="layui-textarea">
                            ${(logMessage.logDescription)!}
                        </textarea>
                    </div>
                </div>
                <input type="hidden" name="logId" value="${(logMessage.logId)!}">
                <input type="hidden" id="belong" value=${(logMessage.belongProject)!}>
                <div class="layui-form-item  layui-footer" style="background-color: #fff">
                    <div class="layui-input-block">
                        <button class="layui-btn" lay-submit lay-filter="formSub">立即提交</button>
                        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                    </div>
                </div>
            </div>
        </form>
    </div>
</div>
<script src="/static/layui/layui.js"></script>
<script>
    //JavaScript代码区域
    layui.use(['table', 'form', 'laydate', 'jquery', 'element'], function () {
        var element = layui.element;
        var form = layui.form;
        var $ = layui.$;
        var belongProject = $("#belong").val();
        $(document).ready(function () {
            //预加载
            $("#select").val(belongProject);
        });


        //监听提交
        form.on('submit(formSub)', function (data) {
            /*layer.msg(JSON.stringify(data.field));*/
            $.ajax({
                url: '/log/saveLog',
                method: 'post',
                data: data.field,
                success: function (data) {
                    if (data.code == 0) {
                        parent.layer.msg("修改成功!", {time: 1000}, function () {
                            //重新加载父页面
                            parent.location.reload();
                        });
                        return;
                    } else {
                        layer.alert("修改失败")
                    }
                },
                error: function () {
                    layer.alert("修改失败")
                }
            });
            return false;
        });
    })
    ;

</script>
</body>

</html>